#!/usr/bin/python3

import pymysql

db = pymysql.connect("localhost", "root", "47691288.", "zhouheng")

cursor = db.cursor()

sql = "INSERT INTO bank_account(account, password, money) VALUES('000006','123456',1000)"

try:
    # 执行插入操作
    cursor.execute(sql)
    # 成功:提交事务
    db.commit()
    print("插入数据成功")
except:
    # 失败:回滚事务
    db.rollback()
    print("插入数据失败")

db.close()